package com.gruppe1.inu.Model;

import java.util.ArrayList;
import java.util.List;



public class Group {

	String name;
	ArrayList<ListViewEntry> members;


	public Group(){
		members = new ArrayList<ListViewEntry>();
		 name ="";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void addMembers(List<ListViewEntry> group){
		members.addAll(group);
	}

	public void removeMember(ListViewEntry entry){
		members.remove(entry);
	}

	public ArrayList<ListViewEntry> getAllMembers(){
		return members;

	}

public String getNamesList(){
		String namesOfmembers= "";
		if (members.size() < 5)	{

			for (int i = 0; i < members.size(); i++) {
				namesOfmembers += members.get(i).getContactName() +", ";
			}
		return namesOfmembers;
		}
		
		else {
			for (int i = 0; i < 5; i++) {
				namesOfmembers += members.get(i).getContactName() +", ";
			}
			namesOfmembers += "og " +(members.size()-5) +" andre";
			return namesOfmembers;
		}

	}


}
